<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('设备控制记录')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>IMEI号：</label>
                                <input type="text" name="deviceImei"/>
                            </li>
                            <li>
                                <label>控制类型：</label>
                                <select name="controlType" class="form-control">
                                    <option value="">所有</option>
									<option value="getinfo">获取设备信息</option>
                                    <option value="getserver">获取服务器地址</option>
                                    <option value="setserver">设置服务器地址</option>
                                    <option value="upgrade">设备升级</option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>记录时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" th:value="${startDate}" name="params[beginTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" th:value="${endDate}" name="params[endTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="record:reading:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var prefix = ctx + "record/control";

        $(function() {
            var options = {
                url: prefix + "/list",
                exportUrl: prefix + "/export",
                sortName: "createTime",
                sortOrder: "desc",
                pageSize: 15,
                pageList: [30, 50, 100, 200],
                modalName: "设备控制信息",
                columns: [
                {
                    field: 'recordId',
                    title: '记录id',
                    visible: false
                },
                {
                    field: 'deviceImei',
                    title: 'IMEI号',
                    sortable: true
                },
                {
                    field: 'controlType',
                    title: '控制类型',
                    sortable: true,
                    formatter: function(value, row, index) {
                        if(row.controlType == 'getinfo') {
                            return '获取设备信息';
                        } else if(row.controlType == 'getserver') {
                            return '获取服务器地址';
                        } else if(row.controlType == 'setserver') {
                            return '设置服务器地址';
                        } else if(row.controlType == 'offserver') {
                            return '关闭通道';
                        } else if(row.controlType == 'upgrade') {
                            return '设备升级';
                        }
                    }
                },
                {
                    field: 'controlParam',
                    title: '控制参数',
                    sortable: true
                },
                {
                    field: 'createBy',
                    title: '创建人',
                    sortable: true
                },
                {
                    field: 'createTime',
                    title: '下发时间',
                    sortable: true
                },
                {
                    field: 'updateTime',
                    title: '返回时间',
                    sortable: true
                },
                {
                    field: 'remark',
                    title: '备注'
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>